//
//  ScanView.m
//  Restaurant
//
//  Created by wanghuan on 15/5/7.
//  Copyright (c) 2015年 wanghuan. All rights reserved.
//

#import "ScanView.h"

#define Point 20
#define Bordercolor [UIColor colorWithRed:0 green:0.5 blue:1 alpha:1]

@implementation ScanView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.

*/
- (void)drawRect:(CGRect)rect {
  

    CGContextRef context=UIGraphicsGetCurrentContext();
    
    CGContextSetLineWidth(context, 15);
    CGContextSetLineCap(context, kCGLineCapSquare);
//    CGContextSetLineJoin(context, kCGLineJoinBevel);
    
    
    CGMutablePathRef path=CGPathCreateMutable();
    CGPathMoveToPoint(path, NULL, 0, Point);
    
    CGPathAddLineToPoint(path, NULL, 0, 0);
    CGPathAddLineToPoint(path, NULL, Point, 0);
    CGContextAddPath(context, path);
    
    [Bordercolor setStroke];
    
    CGContextDrawPath(context, kCGPathStroke);
    
    CGPathRelease(path);
    
    CGMutablePathRef pathRight = CGPathCreateMutable();
    CGPathMoveToPoint(pathRight, nil, rect.size.width-Point, 0);
    CGPathAddLineToPoint(pathRight, nil, rect.size.width, 0);
    CGPathAddLineToPoint(pathRight, nil, rect.size.width, Point);
    [Bordercolor setStroke];
    CGContextDrawPath(context, kCGPathStroke);
    CGContextAddPath(context, pathRight);
    CGPathRelease(pathRight);
    
    CGMutablePathRef pathRightBottom = CGPathCreateMutable();
    CGPathMoveToPoint(pathRightBottom, nil, rect.size.width,rect.size.height-Point);
    CGPathAddLineToPoint(pathRightBottom, nil, rect.size.width, rect.size.height);
    CGPathAddLineToPoint(pathRightBottom, nil, rect.size.width-Point, rect.size.height);
    [Bordercolor setStroke];
    CGContextDrawPath(context, kCGPathStroke);
    CGContextAddPath(context, pathRightBottom);
    CGPathRelease(pathRightBottom);
    
    
    CGMutablePathRef pathBottom = CGPathCreateMutable();
    CGPathMoveToPoint(pathBottom, nil, 0,rect.size.height-Point);
    CGPathAddLineToPoint(pathBottom, nil, 0,rect.size.height);
    CGPathAddLineToPoint(pathBottom, nil, Point, rect.size.height);
   [Bordercolor setStroke];
    CGContextAddPath(context, pathBottom);
    CGContextDrawPath(context, kCGPathStroke);
    
    CGPathRelease(pathBottom);

}


@end
